//
//  BaseTableViewController.swift
//  dwdWb
//
//  Created by Dengdwd on 15/10/6.
//  Copyright © 2015年 dwd. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorViewDelegate {

    var vistorView : VisitorView?
    
    var loginState = UserAcount.loadUserData() != nil
//    var loginState = false
    override func loadView() {
        if loginState {
        super.loadView()
        return
    }
        vistorView = NSBundle.mainBundle().loadNibNamed("VisitorView", owner: nil, options: nil).last as? VisitorView
        view = vistorView
        vistorView?.visitorDelegate = self
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorRegister")
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLogin")
    }
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
       
       
    }
    func visitorLogin() {
//        print(__FUNCTION__)
        let sb = UIStoryboard(name: "OAuth", bundle: nil)
        let vc = sb.instantiateInitialViewController()!
        presentViewController(vc, animated: true, completion: nil)
    }
    func visitorRegister() {
//        print(__FUNCTION__)
    }


}
